package lec04.am.sb;

abstract class  A {
	int x=3;
	void f(){
		System.out.println("A.f() called");
	}
	abstract void g();
}
class B extends A {
	int y=4;
	void f()	{
		System.out.println("B.f()");
	}
	void g()	{
		System.out.println("B.g()");
	}
}
abstract class  C extends A{
	
}
public class SubClassDemo {
	public static void main(String[] args) {
		A a=new B();
		System.out.println(a.x);
		//a=new A();
	//	System.out.println(a.y);
		B b=(B) a;
		System.out.println(b.y);
		a.f();
		a.g();
		((B)a).g();
	}
}
